package com.luntan.util.web;

import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter;

/**
 *
 * 解决FCK插件与Struts2冲突的类
 */
public class LianshuoPrepareAndExecuteFilter extends StrutsPrepareAndExecuteFilter{
    
    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {

        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
        String requestURI = request.getRequestURI();
        //System.out.println(request.getRequestURL());
        if(requestURI.contains("editor")){//不需要Struts2处理的请求
            //System.out.println(request.getRequestURL());
            chain.doFilter(request, response);
        }else{//需要Struts2处理的请求
            super.doFilter(req,res,chain);
        }

    }
}
